//
//  LGSportsEvaRecordCell.m
//  HeartDiseaseManage
//
//  Created by 1234 on 2023/8/11.
//

#import "LGSportsEvaRecordCell.h"

@interface LGSportsEvaRecordCell()

/**   */
@property (nonatomic , strong)UIView *baseView;
/**   */
@property (nonatomic , strong)UIImageView *tipView;
/**   */
@property (nonatomic , strong)UIImageView *iconView;
/**   */
@property (nonatomic , strong)UILabel *titleLabel;
/**   */
@property (nonatomic , strong)UILabel *dateLabel;
/**   */
@property (nonatomic , strong)UIButton *checkBtn;

@end

@implementation LGSportsEvaRecordCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        self.clipsToBounds = YES;
        self.contentView.backgroundColor = [UIColor colorWithString:@"#F9F9F9"];
        [self.contentView addSubview:self.baseView];
        [self.baseView addSubview:self.iconView];
        [self.baseView addSubview:self.titleLabel];
        [self.baseView addSubview:self.dateLabel];
        [self.baseView addSubview:self.checkBtn];
        [self.baseView addSubview:self.tipView];
    }
    return  self;
}

-(void)setDateStr:(NSString *)dateStr{
    _dateStr = dateStr;
    self.dateLabel.text = dateStr;
}

-(void)setIndex:(NSInteger)index{
    _index = index;
    self.tipView.hidden = (index == 0)?NO:YES;
}

#pragma mark
#pragma mark ====> 创建控件
-(UIView *)baseView{
    if(!_baseView){
        _baseView = [UIView shadowViewWithColor:@"#B2BDC7" offset:CGSizeMake(0, 2) opacity:0.15 radius:15];
        _baseView.frame = CGRectMake(viewPix(16), viewPix(8), Screen_W-viewPix(32), viewPix(53));
        _baseView.backgroundColor = [UIColor whiteColor];
    }
    return _baseView;
}

-(UIImageView *)tipView{
    if(!_tipView){
        _tipView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"运动评估-最新"]];
        _tipView.frame = CGRectMake(0, 0, viewPix(37), viewPix(37));
        _tipView.hidden = YES;
    }
    return _tipView;
}

-(UIImageView *)iconView{
    if(!_iconView){
        _iconView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"我的订单-订单时间"]];
        _iconView.frame = CGRectMake(viewPix(12), viewPix(18), viewPix(16), viewPix(16));
    }
    return _iconView;
}

-(UILabel *)titleLabel{
    if(!_titleLabel){
        _titleLabel = [UILabel lableWithText:@"评估日期" colorString:@"#666666" textFont:LGFont(15) textAlignment:NSTextAlignmentLeft lines:1];
        _titleLabel.frame = CGRectMake(viewPix(32), 0, viewPix(65), viewPix(53));
    }
    return _titleLabel;
}

-(UILabel *)dateLabel{
    if(!_dateLabel){
        _dateLabel = [UILabel lableWithText:@"" colorString:@"#333333" textFont:LGFont(15) textAlignment:NSTextAlignmentLeft lines:1];
        _dateLabel.frame = CGRectMake(viewPix(106), 0, viewPix(110), viewPix(53));
    }
    return _dateLabel;
}

-(UIButton *)checkBtn{
    if(!_checkBtn){
        _checkBtn = [UIButton buttonWithTitle:@"查看" titleFont:LGFont(15) textColor:@"#666666" imageName:@"grayTip12"];
        _checkBtn.frame = CGRectMake(Screen_W-viewPix(32)-viewPix(60), 0, viewPix(50), viewPix(53));
        [_checkBtn setButtonInsetsStyle:LGButtonInsetsStyleRight marginSpace:3];
        _checkBtn.userInteractionEnabled = NO;
    }
    return _checkBtn;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
